function V = scarymovieu(theta,p,y_normal,y_disaster,q_r,r_1,r_2)

%condition on y


V = (1-p)*Vcond(theta,y_normal,q_r,r_1,r_2) + ...
    p*Vcond(theta, y_disaster,q_r,r_1,r_2);


function V = Vcond(theta,y,q_r,r_1,r_2)

V = q_r*u(1+y + theta*r_1) + (1-q_r)*u(1+y+ theta*r_2);



function uval = u(x)

gamma = 1;

if gamma == 1
    uval = log(x);
else
    uval = x^(1-gamma)/(1-gamma);
end
